<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Symfony\Component\Console\Helper\ProgressBar;

class SendEmails extends Command
{

    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'testEmail:send {user}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '自己学着玩';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
      //
      $user = $this->argument('user');
      echo $user;

      // $name = $this->ask('What is your name?'.$user);

      // $name = $this->anticipate('What is your name?', ['Taylor', 'Dayle']);

      $users = [];
      for ($i=0; $i < 100; $i++) { 
        $users[] = $i+1;
      }

      $bar = $this->output->createProgressBar(count($users));
      foreach ($users as $user) {
          $this->performTask($user);
          $bar->advance();
      }

      $bar->finish();

    }
}
